define(function(require,exports,module){
    var Form = require("form");
    var store = require("store");

    module.exports = {
        initComponent: function(widget){
            var form = new Form({
                parentNode: ".J-form",
                model: {
                    id: "form",
                    defaultButton: false,
                    layout: "2_1",
                    items: [{
                    	name: "pkProductRule",
                    	type: "hidden"
                    },{
                    	name: "version",
                    	type: "hidden",
                    	defaultValue: 0
                    },{
                        name: "product",
                        label: "产品名称",
                        type: "select",
                        url: "api/product/query",
                        keyField: "pkProduct",
                        valueField: "name",
                        events: {
                        	change: function(){
                        		widget.handler.form
                        			.handleProdSelChange(widget)
                        	}
                        }
                    },{
                        name: "checkInNum",
                        label: "入住适用人数"
                    },{
                        name: "travelNum",
                        label: "旅居适用人数"
                    },{
                        name: "communityDatas",
                        label: "产品适用地区",
                        url: "api/communitydata/comorgrelation",
                        multi: true,
                        params: function(){
                        	return {
                        		pkOrganization: store.get("user").organization.pkOrganization,
                        		statusIn: "Setting"
                        	};
                        },
                        type: "select",
                        keyField: "pkCommunityData",
                        valueField: "name",
                        validate: ["required"]
                    },{
                        name: "roomNum",
                        label: "适用房间数(间/次)"
                    },{
                        name: "isReturn",
                        label: "可退还",
                        type:"radio",
                        list: [{
                        	key:"true",
                        	value: "是",
                        	isDefault: true
                        },{
                        	key:"false",
                        	value: "否"
                        }]
                    },{
                        name: "transfer",
                        label: "可转让",
                        type:"radio",
                        list: [{
                        	key:"true",
                        	value: "是",
                        	isDefault: true
                        },{
                        	key:"false",
                        	value: "否"
                        }]
                    },{
                        name: "isExtends",
                        label: "可继承",
                        type:"radio",
                        list: [{
                        	key:"true",
                        	value: "是",
                        	isDefault: true
                        },{
                        	key:"false",
                        	value: "否"
                        }]
                    },{
                        name: "lendable",
                        label: "可借出",
                        type:"radio",
                        list: [{
                        	key:"true",
                        	value: "是",
                        	isDefault: true
                        },{
                        	key:"false",
                        	value: "否"
                        }]
                    },{
                        name: "renewable",
                        label: "可续签",
                        type:"radio",
                        list: [{
                        	key:"true",
                        	value: "是",
                        	isDefault: true
                        },{
                        	key:"false",
                        	value: "否"
                        }]
                    },{
                        name: "description",
                        label: "备注",
                        "break": true,
                        type: "textarea"
                    }]
                }
            });

            widget.set("form",form)
        }
    };
});